import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/admin/login',
    method: 'post',
    data
  })
}

export function create(data) {
  return request({
    url: '/admin',
    method: 'post',
    data
  })
}

export function remove(id) {
  return request({
    url: '/admin/' + id,
    method: 'delete'
  })
}

export function update(data) {
  return request({
    url: '/admin',
    method: 'put',
    data
  })
}

export function registry(data) {
  return request({
    url: '/admin/registry',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/admin/info',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/admin/logout',
    method: 'post'
  })
}

export function page(data) {
  return request({
    url: '/admin/list/' + data.page + '/' + data.size,
    method: 'get',
    data: null
  })
}

export function user(data) {
  return request({
    url: '/admin/user/' + data.page + '/' + data.size,
    method: 'get',
    data: null
  })
}

export function code(data) {
  return request({
    url: '/admin/code',
    method: 'get',
    data
  })
}

export function checkCode(data) {
  return request({
    url: '/admin/code/check',
    method: 'get',
    data
  })
}

export function roles() {
  return request({
    url: '/role',
    method: 'get'
  })
}

